# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union
from fastapi import Query
from pydantic import BaseModel, Field


class MusicRecordSearchIn(BaseModel):
    """ 音乐记录搜索参数 """
    page_no: int = Query(default=1, gt=0, description="当前页码")
    page_size: int = Query(default=15, gt=0, le=200, description="每页条数")
    mode: Union[str, None] = Query(default=None, description="歌曲模式: [muse,lyric]")
    prompt: Union[str, None] = Query(default=None, description="提示词")
    user_sn: Union[str, None] = Query(default=None, description="用户编号")
    status: Union[int, str, None] = Query(default=None, description="生成状态: [0=等待中,1=执行中,2=成功,3=失败]")
    start_time: Union[str, None] = Query(default=None, description="开始时间")
    end_time: Union[str, None] = Query(default=None, description="结束时间")


class MusicRecordDeleteIn(BaseModel):
    """ 音乐记录删除参数 """
    id: int = Field(..., gt=0, description="ID")
    reason: str = Field(default="", description="原因描述")


"""--------------- Separator ---------------"""


class MusicRecordVo(BaseModel):
    """ 音乐记录列表Vo """
    id: int = Field(description="ID")
    code: str = Field(description="编号")
    mode: str = Field(description="歌曲模式: [灵感=muse, 歌词=lyric]")
    engine: str = Field(description="音乐引擎")
    channel: str = Field(description="音乐渠道")
    title: str = Field(description="歌曲标题")
    prompt: str = Field(description="歌曲描述")
    tags: str = Field(description="歌曲风格")
    mv: str = Field(description="模型版本")
    make_instrumental: bool = Field(description="是否纯音乐")
    cover_url: str = Field(description="音乐封面")
    audio_url: str = Field(description="音乐地址")
    lyric: str = Field(description="音乐歌词")
    duration: int = Field(description="时长(秒)")
    use_points: int = Field(description="消耗积分")
    ip: str = Field(description="来源IP")
    status: int = Field(description="生成状态: [0=等待中, 1=执行中, 2=成功, 3=失败]")
    is_free: int = Field(description="会员免费: [0=否, 1=是]")
    create_time: str = Field(description="创建时间")
    user: dict = Field(description="用户信息")
